package middleware

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

func ApiKeyCheck() gin.HandlerFunc {
	return func(c *gin.Context) {
		// web操作直接下去
		apiKey := c.GetHeader("X-API-KEY")
		if apiKey != "a3f6c5d9" {
			c.JSON(http.StatusUnauthorized, nil)
			c.Abort()
			return
		}

		c.Next()
	}
}
